﻿using System;
using Gp.Scripts.Core;
using QFramework;
using UnityEngine;
using UnityEngine.UI;

namespace Gp.Scripts.GUI {
    public class TurnOrderImg : MonoBehaviour {
        public Image avatar;

        // [SerializeField] public TMP_Text num;
        private Button _button;
        
        public BaseUnit Unit { get; set; }


        // public ActionPointDisplay
        // public GameObject actionPointIcon;
        // public GameObject bonusActionPointIcon;

        public Transform actionPointParent;
        public Transform bonusActionPointParent;


        private void Update() {
            if (Unit == null) return;
            // avatar.sprite = Unit.Avatar;

            var action = Unit.ComCost.GetResource(CostField.ActionTime);
            // var bonusAction = Unit.Resource.GetResource(ResourceType.BonusAction);
            
            
            for (int i = 0; i < actionPointParent.childCount; i++) {
                actionPointParent.GetChild(i).gameObject.SetActive(i < action);
            }
            
        }


        private void Start() {
            // _button = GetComponent<Button>();
            //
            // // 当该图片被点击时，视为该单位被点击
            // _button.onClick.AddListener(() => {
            //     CellGridSystem.Instance.CellGridModel.CellGridState?.OnUnitClicked(Unit);
            // });
        }
    }
}